//
//  AppDelegate.swift
//  WeiBo
//
//  Created by Li MAc on 2018/11/13.
//  Copyright © 2018 Li MAc. All rights reserved.
//

import UIKit
import SVProgressHUD
import AFNetworking
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        
        //沉默2S
//        sleep(2)
        
        window = UIWindow()
        window?.backgroundColor = UIColor.red
        
        window?.rootViewController = LMMainViewController()
        window?.makeKeyAndVisible()
        
        
        return true
    }


}

extension AppDelegate {
    
    private func loaddemm(){
        
        //1.模拟异步
        DispatchQueue.global().async {
            let url = Bundle.main.url(forResource: "demm.josn", withExtension: nil)
            let data = NSData(contentsOf: url!)
            let de = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
            
            let path = (de as NSString).appending("demm.josn")
            data?.write(toFile: path, atomically: true)
            
            
        }
    }
}

extension AppDelegate {
    private func setupSVPMianTime(){
        //设置 SVProgressHUD 的最小解除时间
        SVProgressHUD.setMinimumDismissTimeInterval(3)
        
        //设置网络加载指示器 （网络小菊花）
        AFNetworkActivityIndicatorManager.shared().isEnabled = true
        
        
//        if #available(iOS 10.0, *){
//
//        }
    }
}
